<?php
$val = array(); 
$val = Lemar_Basic::ObjectToArray($this->aProfile);
$val['phone1'] = $val['phone2'] = $val['phone3'] = '';
if (strpos($val['phone'], '.'))
{
	list ($val['phone1'], $val['phone2'], $val['phone3']) = explode('.', $val['phone']);
}
//print_r($val);
?>

<div class="grid_7 group_r">

<form name="registration" id="registration" action="/profile/update" method="post">

	<div class="hdr">Your Information</div>
	<div class="cleft">
	<?php if (isset($this->infoMessages)) {?>
	<div class="error_msg"><?php echo $this->infoMessages?></div>
	<?php }?>
<p>
		<div>
			<em class="required">*</em>
			<label for="email">Email address</label>
			<input type="text" value="<?php if (isset($val['email'])) echo $val['email'] ;?>" name="email" id="email" maxlength="255" tabindex="1" />
		</div>
		<?php if(isset($this->aError['email'])) { foreach($this->aError['email'] as $ErrName => $ErrDescr) { ?>
			<div class="error_msg"><?php echo $ErrDescr; ?></div>
		<?php } } ?>
		
			
		<div>
			<em class="required">*</em>
			<label for="password">Password</label>
			<input type="password" value="<?php  if (isset($val['password'])) echo $val['password'];?>" name="password" id="password" maxlength="255" tabindex="3" />
		</div>
		<?php if(isset($this->aError['password'])) { foreach($this->aError['password'] as $ErrName => $ErrDescr) { ?>
			<div class="error_msg"><?php echo $ErrDescr; ?></div>
		<?php } } ?>

		<div>
			<label for="new_password">New Password</label>
			<input type="password" value="<?php  if (isset($val['new_password'])) echo $val['new_password'];?>" name="new_password" id="new_password" maxlength="255" tabindex="3" />
		</div>
		<?php if(isset($this->aError['new_password'])) { foreach($this->aError['new_password'] as $ErrName => $ErrDescr) { ?>
			<div class="error_msg"><?php echo $ErrDescr; ?></div>
		<?php } } ?>
		
		<div>
			<label for="re_enter_password">Re-enter New password</label>
			<input type="password" value="<?php  if (isset($val['re_enter_password'])) echo $val['re_enter_password'];?>" name="re_enter_password" id="re_enter_password" maxlength="255" tabindex="4" />
		</div>
		<?php if(isset($this->aError['re_enter_password'])) { foreach($this->aError['re_enter_password'] as $ErrName => $ErrDescr) { ?>
			<div class="error_msg"><?php echo $ErrDescr; ?></div>
		<?php } } ?>
</p>

<p>
		<div>
			<em class="required">*</em>
			<label for="first_name">First Name</label>
			<input type="text" value="<?php  if (isset($val['first_name'])) echo $val['first_name'];?>" name="first_name" id="first_name" maxlength="255" tabindex="5" />
		</div>
		<?php if(isset($this->aError['first_name'])) { foreach($this->aError['first_name'] as $ErrName => $ErrDescr) { ?>
			<div class="error_msg"><?php echo $ErrDescr; ?></div>
		<?php } } ?>
		
		<div>
			<em class="required">*</em>
			<label for="last_name" >Last Name</label>
			<input type="text" value="<?php if (isset($val['last_name'])) echo $val['last_name'];?>" name="last_name" id="last_name" maxlength="255" tabindex="6" />
		</div>
		<?php if(isset($this->aError['last_name'])) { foreach($this->aError['last_name'] as $ErrName => $ErrDescr) { ?>
			<div class="error_msg"><?php echo $ErrDescr; ?></div>
		<?php } } ?>
	
		<div>
			<label for="profession_areas">Areas of Interest or Expertise</label>
			<input type="text" value="<?php if (isset($val['profession_areas'])) echo $val['profession_areas'];?>" name="profession_areas" id="profession_areas" maxlength="255" tabindex="7" />
		</div>
		<?php if(isset($this->aError['profession_areas'])) { foreach($this->aError['profession_areas'] as $ErrName => $ErrDescr) { ?>
			<div class="error_msg"><?php echo $ErrDescr; ?></div>
		<?php } } ?>
		
		<div>
			<label for="profession">Profession</label>
			<input type="text" value="<?php if (isset($val['profession'])) echo $val['profession'];?>" name="profession" id="profession" maxlength="255" tabindex="8" />
		</div>
		<?php if(isset($this->aError['profession'])) { foreach($this->aError['profession'] as $ErrName => $ErrDescr) { ?>
			<div class="error_msg"><?php echo $ErrDescr; ?></div>
		<?php } } ?>
		
			
		<div>
			<label for="city">City</label>
			<input type="text" value="<?php  if (isset($val['city'])) echo $val['city'];?>" name="city" id="city" maxlength="255" tabindex="8" />
		</div>
		<?php if(isset($this->aError['city'])) { foreach($this->aError['city'] as $ErrName => $ErrDescr) { ?>
			<div class="error_msg"><?php echo $ErrDescr; ?></div>
		<?php } } ?>
	
		<div>
			<label for="state">State / Province</label>
			<select name="state" tabindex="9" >
				<?php 
					foreach ($this->allStates as $literal => $name)
					{
				?>
					<option value="<?php echo $literal; ?>" <?php echo  ($val['state'] == $literal) ? 'selected' : ''; ?>><?php echo $name; ?></option>
				<?php 
					}
				?>
			</select>
		</div>
		<?php if(isset($this->aError['state'])) { foreach($this->aError['state'] as $ErrName => $ErrDescr) { ?>
			<div class="error_msg"><?php echo $ErrDescr; ?></div>
		<?php } } ?>
		
		<div>
			<label for="zip">ZIP / Postal code</label>
			<input type="text" value="<?php  if (isset($val['zip'])) echo $val['zip'];?>" name="zip" id="zip" maxlength="255" tabindex="10" />
		</div>
		<?php if(isset($this->aError['zip'])) { foreach($this->aError['zip'] as $ErrName => $ErrDescr) { ?>
			<div class="error_msg"><?php echo $ErrDescr; ?></div>
		<?php } } ?>

		<div>
			<label for="country">Country</label>
				<select class="description_form" name="country" tabindex="11">
				<?php 
					foreach ($this->allCountries as $country)
					{
				?>
					<option value="<?php echo $country->name; ?>" <?php echo  ($val['country'] == $country->name) ? 'selected' : ''; ?>><?php echo $country->name; ?></option>
				<?php 
					}
				?>
				</select>			
		</div>
		<?php if(isset($this->aError['country'])) { foreach($this->aError['country'] as $ErrName => $ErrDescr) { ?>
			<div class="error_msg"><?php echo $ErrDescr; ?></div>
		<?php } } ?>
		
		<div>
			<label for="phone">Primary telephone number</label>
			<input type="text" value="<?php  if (isset($val['phone1'])) echo $val['phone1'];?>" name="phone1" id="phone1" maxlength="5" size="5" tabindex="12" />
			<input type="text" value="<?php  if (isset($val['phone2'])) echo $val['phone2'];?>" name="phone2" id="phone2" maxlength="5" size="5" tabindex="13" />
			<input type="text" value="<?php  if (isset($val['phone3'])) echo $val['phone3'];?>" name="phone3" id="phone3" maxlength="5" size="5" tabindex="14" />
		</div>
		<?php if(isset($this->aError['phone'])) { foreach($this->aError['phone'] as $ErrName => $ErrDescr) { ?>
			<div class="error_msg"><?php echo $ErrDescr; ?></div>
		<?php } } ?>
</p>
<p>
		<div>
			<em class="required">*</em> Items with asterisks are required
		</div>
</p>

	</div>



<input type="submit" value="Save" name="registration_submit" id="registration_submit" />
</form>
</div>
